package com.xtravel.discovery.viewholder;

import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.lidroid.xutils.BitmapUtils;
import com.xtravel.R;
import com.xtravel.common.widget.RoundImageView;
import com.xtravel.common.widget.TweetImageView;
import com.xtravel.discovery.dto.TalentDto;

/**
 * Created by memory on 15/12/5.
 */
public class LiveTalentViewHolder extends BaseViewHolder<TalentDto> {
    private TweetImageView talentCover;
    private RoundImageView roundImageView;
    private TextView talentName;
    private LinearLayout talentPanel;

    public LiveTalentViewHolder(Context context, BitmapUtils bitmapUtils, LayoutInflater layoutInflater)
    {
        super(context, bitmapUtils, layoutInflater);
    }

    @Override
    public View getView() {
        final View convertView = layoutInflater.inflate(R.layout.talent_item, null);
        talentPanel = (LinearLayout)convertView.findViewById(R.id.talent_item_panel);
        talentCover = (TweetImageView)convertView.findViewById(R.id.talent_item_cover);
        talentName = (TextView)convertView.findViewById(R.id.talent_item_name);
        roundImageView = (RoundImageView)convertView.findViewById(R.id.live_talent_headpic);
        talentPanel.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View view) {

            }
        });
        convertView.setTag(this);
        return convertView;
    }

    @Override
    public void setValue(TalentDto talent) {
        this.talentCover.setImageUrl(this.bitmapUtils, talent.coverUrl);
        this.talentName.setText(talent.nickname);
        this.roundImageView.setImageUrl(bitmapUtils, talent.headPicture);
        this.talentPanel.setTag(talent);
    }
}
